//
//  HRShowSoundContentView.m
//  Hear
//
//  Created by mac on 2017/4/21.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "HRShowSoundContentView.h"
#import "HRSoundExampleViewController.h"
@interface HRShowSoundContentView ()
@property (nonatomic, strong)UITextView *contentTextView;
@property (nonatomic, strong)UIButton *nextContentButton;

@end
@implementation HRShowSoundContentView

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        self.contentTextView = [UITextView new];
        self.contentTextView.text = @"还怕录音时忘词嘛？把要说的话编辑到这里吧，输入的文字不会被发送哒！";
        self.contentTextView.textColor = FirstTextColor;
        self.contentTextView.font = CustomUIFont(13);
        [self addSubview:self.contentTextView];
        self.contentTextView.layer.borderWidth = 1;
        self.contentTextView.layer.borderColor = CustomColor(240, 240, 240, 1).CGColor;
        self.contentTextView.layer.cornerRadius = 6;
        
        UIButton *nextContentButton = [UIButton buttonWithType:0];
        [nextContentButton setTitle:@"看看其他hearers怎么说" forState:UIControlStateNormal];
        [nextContentButton setTitleColor:CustomColor(246, 158, 126, 1) forState:UIControlStateNormal];
        nextContentButton.titleLabel.font = [UIFont boldSystemFontOfSize:13];
        [nextContentButton addTarget:self action:@selector(nextContentButtonClick) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:nextContentButton];
        self.nextContentButton = nextContentButton;
        nextContentButton.titleLabel.textAlignment = 2;
        
        WeakSelf
        [self.contentTextView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(weakSelf);
            make.left.equalTo(weakSelf).offset(10);
            make.bottom.equalTo(weakSelf).offset(-40);
            make.right.equalTo(weakSelf).offset(-10);
        }];
        
        [nextContentButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(weakSelf.contentTextView.mas_right);
            make.top.equalTo(weakSelf.contentTextView.mas_bottom);
            make.bottom.equalTo(weakSelf).offset(-5);
            make.width.mas_equalTo(160);
        }];
        
    }
    return self;
}

- (void)nextContentButtonClick{
    HRSoundExampleViewController *soundVC = [HRSoundExampleViewController new];
    [VIEWCCONTROLER.navigationController pushViewController:soundVC animated:YES];
    
    WeakSelf
    soundVC.copyButotnClickBlock = ^(NSString *contentStr){
        weakSelf.contentTextView.text = contentStr;
    };
}


@end
